# -*- coding: utf-8 -*-
import sys, cv2
import pprint as pp

# Luminance Methode
def luminance(left,top,right):


    luminance= (left/3+right/3+top/3)


    return luminance

# Bias Methode
def bias(left,right):

    bias= ((left/2)-(right/2))+127


    return bias

# Brightness Methode
def brightness(top,left,right):

    brightness= ((top/2)-(((left/2)+(right/2))/2))+127

    return brightness

def p(i):
    pp.pprint(i.tolist()[0][:30])
    
if __name__ == "__main__":
    print '\n-----------\n'
    print 'AKIN'

    # Bilder werden gelesen
    left = cv2.imread("cover_left.JPG")

    right = cv2.imread("cover_right.JPG")

    top = cv2.imread("cover_top.JPG")

    # Bilder werden in Schwarz-Weiß umgewandelt
    left = cv2.cvtColor(left,cv2.COLOR_BGR2GRAY)
    right = cv2.cvtColor(right,cv2.COLOR_BGR2GRAY)
    top = cv2.cvtColor(top,cv2.COLOR_BGR2GRAY)

    luminance = luminance(left,top,right)
    p(luminance)
    bias = bias(left,right)
    brightness = brightness(top,left,right)

    # Fenster werden erstellt
    window_luminance = cv2.namedWindow("Image Viewer")
    cv2.imshow("Image Viewer", luminance)



    
    ## window_bias = cv2.namedWindow("Image Viewer1")
    ## cv2.imshow("Image Viewer1", bias)
    ## window_brightness = cv2.namedWindow("Image Viewer2")
    ## cv2.imshow("Image Viewer2", brightness)
    ## # Bilder werden gespeichert
    ## cv2.imwrite("luminance.JPG",luminance)
    ## cv2.imwrite("bias.JPG",bias)
    ## cv2.imwrite("brightness.JPG",brightness)

    cv2.waitKey(0)
